package com.fetnet.smsalarm;

import android.app.Notification;
import android.app.NotificationManager;
import android.app.PendingIntent;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.MediaPlayer;
import android.os.IBinder;

public class MyService extends Service {
	static Notification notification;
    static NotificationManager notificationManager;
    static Intent notifyIntent ;
    static PendingIntent appIntent;
    static MediaPlayer player1 ;
    static MediaPlayer player2 ;
    static MediaPlayer player3 ;
   
@Override
public void onCreate() {
    
    super.onCreate();
    notificationManager=(NotificationManager)super.getSystemService(Context.NOTIFICATION_SERVICE); 
    notifyIntent = new Intent(this,NotifyActivity.class);
    notifyIntent.setFlags( Intent.FLAG_ACTIVITY_NEW_TASK);
    appIntent = PendingIntent.getActivity(this,0,notifyIntent,0);
    Notification notification1 = new Notification();
    startForeground(1, notification1);
    Intent intent = new Intent(this, TextMessageReceiver.class);

    MyService.player1 = MediaPlayer.create(this, R.raw.alarm);
    MyService.player2 = MediaPlayer.create(this, R.raw.alarm2);
    MyService.player3 = MediaPlayer.create(this, R.raw.alarm3);
	startService(intent);
}

@Override
public int onStartCommand(Intent intent, int flags, int startId) {
    super.onStartCommand(intent, flags, startId);
    return START_STICKY;
}

@Override
public IBinder onBind(Intent intent) {
	// TODO Auto-generated method stub
	return null;
}
public void onDestroy() {   
    Intent localIntent = new Intent();
    localIntent.setClass(this, MyService.class);  
    this.startService(localIntent);
}

}